package kulstats;

import java.util.ArrayList;
import java.util.List;

import com.google.appengine.api.datastore.Key;



public abstract class User {
	private Key key;
	private String name;
	private String mail;
	private String userID;
	private List<Course> courses;
	private Integer points;
	private String main;
	private String side;
	
	/**
	 * @param UserID the user's ID
	 */
	public User(Key Key, String Name, String UserID, String Mail, List<Course> Courses, Integer Points) {
		key = Key;
		name = Name;
		userID = UserID;
		mail= Mail;
		courses = Courses;
		points = Points;
	}
	
	public User(Key Key, String Name, String UserID, String Mail, List<Course> Courses, Integer Points, String Main, String Side) {
		key = Key;
		name = Name;
		userID = UserID;
		mail= Mail;
		courses = Courses;
		points = Points;
		main = Main;
		side = Side;
	}
	/**
	 * @return the users name
	 */
	public String getName()
	{
		return name;
	}
	/**
	 * @return the users ID
	 */
	public String getUserID()
	{
		return userID;
	}
	/**
	 * @return the user's ID
	 */
	public Key getKey()
	{
		return key;
	}
	/**
	 * @return the user's courses
	 */
	public List<Course> getCourses()
	{
		return courses;
	}
	
	public List<String> getAllCourseIDs()
	{
		ArrayList<String> result = new ArrayList<String>();
		for(Course course: this.courses)
		{
			String courseID = course.getCourseID();
			result.add(courseID);
		}
		
		return result;
	}

	/**
	 * @param newName the new name of the user
	 */
	public void setName(String newName)
	{
		this.name = newName;
	}
	/**
	 * @param newPassword the new password of the user
	 */
	public void setPassword(String newID)
	{
		this.userID = newID;
	}
	/**
	 * @param newID the new ID of the user
	 */
	public void setKey(Key newKey)
	{
		this.key = newKey;
	}
	/**
	 * @return the mail
	 */
	public String getMail() {
		return mail;
	}
	/**
	 * @param mail the mail to set
	 */
	public void setMail(String mail) {
		this.mail = mail;
	}
	/**
	 * @param newCourse the new course of the user
	 */
	public void addCourse(Course newCourse)
	{
		courses.add(newCourse);
	}
	/**@param oldCourse the course of the user to remove
	 */
	public void removeCourse(Course oldCourse)
	{
		courses.remove(oldCourse);
	}
	/**
	 * @return the userpoints
	 */
	public Integer getPoints()
	{
		return points;
	}
	
	public void setPoints(Integer points)
	{
		this.points = points;
	}
	
	public void updatePoints(Integer newPoints)
	{
		this.points += newPoints;
	}
	/**
	 * @return the main
	 */
	public String getMain() {
		return main;
	}
	/**
	 * @param main the main to set
	 */
	public void setMain(String main) {
		this.main = main;
	}
	/**
	 * @return the side
	 */
	public String getSide() {
		return side;
	}
	/**
	 * @param side the side to set
	 */
	public void setSide(String side) {
		this.side = side;
	}
	
}